package com.tanhua.manage.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.tanhua.domain.db.UserInfo;
import com.tanhua.domain.vo.PageResult;
import com.tanhua.dubbo.api.UserInfoApi;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;

@Service
public class UserService {

    @Reference
    private UserInfoApi userInfoApi;

    //用户数据翻页
    public ResponseEntity<Object> queryUserByPage(Integer page, Integer pagesize) {
        IPage<UserInfo> iPage = userInfoApi.findByPage(page,pagesize);
        PageResult pageResult = new PageResult(page,pagesize,(int)iPage.getTotal(),iPage.getRecords());
        return ResponseEntity.ok(pageResult);
    }

    //用户基本资料
    public ResponseEntity<Object> showUserInfo(Long userID) {
        UserInfo userInfo = userInfoApi.findById(userID);
        return ResponseEntity.ok(userInfo);
    }
}
